package com.wcity.manage.dao.mapper;


import com.wcity.manage.dao.dal.BaseMapper;
import com.wcity.manage.dao.model.Block;
import com.wcity.manage.dao.model.PropertyPay;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.io.Serializable;
import java.util.List;

/**
 * 业主缴费数据管理模块
 * Created by Administrator on 2016/12/9.
 */
@Repository
public interface PropertyPayMapper extends BaseMapper<PropertyPay, Serializable> {

    /**
     *获取小区名称
     * @param id
     * @return
     */
    List<Block> getblockName(int id);

    /**
     * 根据id获取缴费信息
     * @param id
     * @return
     */
    PropertyPay getPayInfo(String id);

    /**
     * 查询缴费数据的所有数据
     * @return
     */
    List<PropertyPay> selectPayModel(PropertyPay propertyPay);

    /**
     * 判断是否存在该缴费账户
     * @param payUser
     * @param payUserTel
     * @param
     * @return
     */
    @Select( "select count(*) from td_pay where pay_user = #{payUser} and pay_user_tel = #{payUserTel}" )
    int selectCount(@Param("payUser") String payUser, @Param("payUserTel") String payUserTel);

    /**
     * 获取一年的费用
     * @param payUser
     * @param payUserTel
     * @param year
     * @return
     */
    PropertyPay getPayFee( String payUser , String payUserTel ,String year );

    /**
     * 获取历年的数据
     * @param payUser
     * @param payUserTel
     * @param year
     * @return
     */
    List<PropertyPay> getYearsList(String payUser, String payUserTel, int year);


    /**
     * 查看小区是否存在
     * @param cellValue
     * @return
     */
    @Select( "select id from td_block where block_name = #{cellValue} and user_id=#{userId}" )
    Block selectBlockName(@Param("cellValue") String cellValue,@Param("userId") int userId);
}
